<!DOCTYPE html >
<html lang="zh-CN">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
        <title>Promise调用</title>
        <link rel="stylesheet" href="./common/mui/mui.css" />
        <link rel="stylesheet" href="./common/common.css" />
    </head>

    <body>

        <div class="mui-content pt0">
            <ul class="mui-table-view ">
                <li class="mui-table-view-cell">
                    <a class="mui-navigate-right api-class" id="alert">alert</a>
                </li>
                <li class="mui-table-view-cell">
                    <a class="mui-navigate-right api-class" id="alert2">alert(callApi)</a>
                </li>

            </ul>
        </div>
        <script type="text/javascript" src="./common/mui/mui.js"></script>
        <script type="text/javascript" src="../dist/quick.js"></script>
        <script type="text/javascript" src="./../dist/quick.native.js"></script>
        <script type="text/javascript" src="./../dist/quick.h5.js"></script>
        <script type="text/javascript" src="./common/common.js"></script>
        <script>
            window.runApi = function(id) {
                console.log('执行API:' + id);

                switch (id) {
                    case 'alert':
                        quick.ui.alert({
                            message: "hello",
                        }).then(function(result) {
                            showTips('点击alert成功，进入then');
                        }).catch(function(error) {
                            showTips('失败:' + JSON.stringify(error));
                        });
                        break;
                    case 'alert2':
                        quick.callApi({
                            name: "alert",
                            mudule: 'ui',
                            data: {
                                message: "hello",
                            }
                        }).then(function(result) {
                            showTips('点击alert成功，进入then');
                        }).catch(function(error) {
                            showTips('失败:' + JSON.stringify(error));
                        });
                        break;
                    default:
                        console.error('错误！没有相应API');
                }
            };
        </script>

    </body>

</html>